import Vue from "vue";
import Router from "vue-router";
import store from '../store';
Vue.use(Router);
import { Toast } from "vant";

const router = new Router({
  scrollBehavior (to,from,savedPosition){
    // return 期望滚动到哪个位置
    // 返回原来的位置
    // return savePosition
    // 返回页面顶部
    return { x:0, y:0 }
    },
  routes: [
    {
      path: "/home",
      name: "Home",
      meta: { index: 0, keepAlive: true ,footer:true},
      component: () =>
        import(/* webpackChunkName: "Home" */"@/page/home.vue"),
    },
    {
      path: "/quotes",
      name: "Quotes",
      meta: { index: 2, footer: true, keepAlive: true },
      component: () => 
        import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */ "@/page/quotes.vue"),
    },
    {
      path: "/funds",
      name: "Funds",
      meta: { footer: true, requireAuth: true, },
      component: () =>
          import(
              /* webpackChunkName: "Home" */ /* webpackPrefetch: true */"@/page/assetsCenter/index.vue"
              ),
    },
    {
      path: "/assetsCenter/index",
      name: "Assets",
      meta: { index: 3 },
      component: () =>
          import(
              /* webpackChunkName: "Assets" */ /* webpackPrefetch: true */"@/page/assetsCenter/index.vue"
              ),
    },
    {
      //充提记录
      path: "/assetsCenter/rechargeWithdrawRecord",
      name: "rechargeWithdrawRecord",
      meta: { index: 4 },
      component: () =>
        import(
          /* webpackChunkName: "rechargeWithdrawRecord" */ /* webpackPrefetch: true */"@/page/assetsCenter/rechargeWithdrawRecord.vue"
        ),
    },
    {
      //充值列表
      path: "/recharge/rechargeList",
      name: "rechargeList",
      meta: { index: 5, keepAlive: true },
      component: () =>
        import(
          /* webpackChunkName: "Home" */ /* webpackPrefetch: true */"@/page/recharge/rechargeList.vue"
        ),
    },
    {
      //充值页面
      path: "/recharge/rechargePage",
      name: "rechargePage",
      meta: { index: 6 },
      component: () =>
        import(
          /* webpackChunkName: "rechargePage" */ /* webpackPrefetch: true */"@/page/recharge/rechargePage.vue"
        ),
    },
    {
      //充值提交
      path: "/recharge/rechargeSubmit",
      name: "rechargeSubmit",
      meta: { index: 7 },
      component: () =>
        import(
          /* webpackChunkName: "rechargeSubmit" */ /* webpackPrefetch: true */"@/page/recharge/rechargeSubmit.vue"
        ),
    },
    {
      //充值详情
      path: "/recharge/rechargeDetail",
      name: "rechargeDetail",
      meta: { index: 8 },
      component: () =>
        import(
          /* webpackChunkName: "rechargeDetail" */ /* webpackPrefetch: true */"@/page/recharge/rechargeDetail.vue"
        ),
    },
    {
      //提现页面
      path: "/withdraw/withdrawPage",
      name: "withdrawPage",
      meta: { index: 9 },
      component: () =>
        import(
          /* webpackChunkName: "withdrawPage" */ /* webpackPrefetch: true */"@/page/withdraw/withdrawPage.vue"
        ),
    },
    {
      //提现申请提交
      path: "/withdraw/withdrawSumbit",
      name: "withdrawSumbit",
      meta: { index: 10 },
      component: () =>
        import(
          /* webpackChunkName: "withdrawSumbit" */ /* webpackPrefetch: true */"@/page/withdraw/withdrawSumbit.vue"
        ),
    },
    {
      //提现申请密码验证
      path: "/withdraw/securityVerification",
      name: "SecurityVerification",
      meta: { index: 10 },
      props(route) {
        return {
          ...route.query
        }
      },
      component: () =>
          import(
              /* webpackChunkName: "SecurityVerification" */ /* webpackPrefetch: true */"@/page/withdraw/withdrawalSecurityVerification"
              ),
    },
    {
      //提现详情
      path: "/withdraw/withdrawDetail",
      name: "withdrawDetail",
      meta: { index: 11 },
      component: () =>
        import(
          /* webpackChunkName: "withdrawDetail" */ /* webpackPrefetch: true */"@/page/withdraw/withdrawDetail.vue"
        ),
    },
    {
      //闪兑页面
      path: "/exchange/exchangePage",
      name: "exchangePage",
      meta: { index: 12, requireAuth :true},
      component: () =>
        import(
          /* webpackChunkName: "Home" */ /* webpackPrefetch: true */"@/page/exchange/exchangePage.vue"
        ),
    },
    {
      //闪兑提交
      path: "/exchange/exchangeSubmit",
      name: "exchangeSubmit",
      meta: { index: 13 },
      component: () =>
        import(
          /* webpackChunkName: "exchangeSubmit" */ /* webpackPrefetch: true */"@/page/exchange/exchangeSubmit.vue"
        ),
    },
    {
      //闪兑历史
      path: "/exchange/exchangeHistory",
      name: "exchangeHistory",
      meta: { index: 14 },
      component: () =>
        import(
          /* webpackChunkName: "exchangeHistory" */ /* webpackPrefetch: true */"@/page/exchange/exchangeHistory.vue"
        ),
    },
    {
      //常见问题
      path: "/CommonProblem",
      name: "CommonProblem",
      meta: { index: 15 },
      component: () => import(/* webpackChunkName: "CommonProblem" */ /* webpackPrefetch: true */"@/page/CommonProblem/index.vue"),
    },
    {
      //帮助中心
      path: "/helpCenter",
      name: "helpCenter",
      meta: { index: 16 },
      component: () => import(/* webpackChunkName: "helpCenter" */ /* webpackPrefetch: true */"@/page/helpCenter/index.vue"),
    },
    {
      //问题详情
      path: "/helpDetail",
      name: "helpDetail",
      meta: { index: 17 },
      component: () => import(/* webpackChunkName: "helpDetail" */ /* webpackPrefetch: true */"@/page/helpCenter/detail"),
    },
    {
      //货币理财盈亏订单详情
      path:"/profitLoss",
      name: "profitLoss",
      component: () => import(/* webpackChunkName: "profitLoss" */ /* webpackPrefetch: true */"@/page/order/CurrencyOrder/profitLoss")
    },
    {
      //理财订单详情
      path:"/financialOrder",
      name: "FinancialOrder",
      component: () => import(/* webpackChunkName: "FinancialOrder" */ /* webpackPrefetch: true */"@/page/order/FinancialOrder/index")
    },
    {
      //矿机订单详情
      path:"/miningMachineOrder",
      name: "MiningMachineOrder",
      component: () => import(/* webpackChunkName: "MiningMachineOrder" */ /* webpackPrefetch: true */"@/page/order/MiningMachineOrder/index")
    },
    {
      //矿机理财购买确认
      path:"/machine-confirm",
      name: "MachineConfirm",
      component: () => import(/* webpackChunkName: "MachineConfirm" */ /* webpackPrefetch: true */"@/page/financialManagement/machineConfirm")
    },
    {
      //基金理财购买确认
      path:"/financial-confirm",
      name: "FinancialConfirm",
      component: () => import(/* webpackChunkName: "FinancialConfirm" */ /* webpackPrefetch: true */"@/page/financialManagement/FinancialManagementConfirm")
    },
    {
      //理财历史
      path:'/financialHistory',
      name:'FinancialHistory',
      component: () => import(/* webpackChunkName: "FinancialHistory" */ /* webpackPrefetch: true */'@/page/FinancialHistory')
    },
    {
      //服务条款
      path:'/TermsOfService',
      name:'TermsOfService',
      component: () => import(/* webpackChunkName: "TermsOfService" */ /* webpackPrefetch: true */'@/page/TermsOfService/index.vue')
    },
    {
      //汇率设置
      path:'/exchangeRate',
      name:'exchangeRate',
      component: () => import(/* webpackChunkName: "exchangeRate" */ /* webpackPrefetch: true */'@/page/exchangeRate/index.vue')
    },
    { //账变记录
      path:'/accountChange',
      name: 'accountChange',
      meta: { requireAuth: true, },
      component: () => import(/* webpackChunkName: "accountChange" */ /* webpackPrefetch: true */'@/page/accountChange/index.vue')
    },
    { //身份认证
      path:'/authentication',
      name: 'authentication',
      component: () => import(/* webpackChunkName: "authentication" */ /* webpackPrefetch: true */'@/page/authentication/index.vue')
    },
    { //身份已认证
      path:'/verified',
      name: 'verified',
      component: () => import(/* webpackChunkName: "verified" */ /* webpackPrefetch: true */'@/page/authentication/verified.vue')
    },
    {   //语言设置
      path:'/language',
      name: 'language',
      component: () => import(/* webpackChunkName: "language" */ /* webpackPrefetch: true */'@/page/language/index.vue')
    },
    {
      //推广中心
      path:'/promote',
      name:'promote',
      meta: { requireAuth: true },
      component: () => import(/* webpackChunkName: "promote" */ /* webpackPrefetch: true */'@/page/promote/index.vue')
    },
    {
      //推广规则
      path:'/promote/rules',
      name:'promoteRules',
      meta: { keepAlive: true},
      component: () => import(/* webpackChunkName: "promoteRules" */ /* webpackPrefetch: true */'@/page/promote/Rules.vue')
    },
    {
      //分享二维码
      path:'/ShareQRCode',
      name:'ShareQRCode',
      meta: { keepAlive: true},
      component: () => import(/* webpackChunkName: "ShareQRCode" */ /* webpackPrefetch: true */'@/page/promote/ShareQRCode.vue')
    },
    {
      //分享海报
      path:'/SharePoster',
      name:'SharePoster',
      // meta: { keepAlive: true},
      component: () => import(/* webpackChunkName: "SharePoster" */ /* webpackPrefetch: true */'@/page/promote/SharePoster.vue')
    },
    { //永续合约
      path:'/perpetualContract/:symbol',
      name:'perpetualContract',
      component: () => import(/* webpackChunkName: "perpetualContract" */ /* webpackPrefetch: true */'@/page/perpetualContract/index.vue'),
      meta: { keepAlive: true, footer: true}
    },
    { //U本位历史
      path:'/perpetualHistory',
      name:'perpetualHistory',
      component: () => import(/* webpackChunkName: "perpetualHistory" */ /* webpackPrefetch: true */'@/page/perpetualContract/perpetualHistory.vue')
    },
    { //永续合约委托详情
      path:'/entrustDetail',
      name:'entrustDetail',
      component: () => import(/* webpackChunkName: "entrustDetail" */ /* webpackPrefetch: true */'@/page/perpetualContract/entrustDetail.vue')
    },
    { //永续合约订单详情
      path:'/orderDetail',
      name:'orderDetail',
      component: () => import(/* webpackChunkName: "orderDetail" */ /* webpackPrefetch: true */'@/page/perpetualContract/orderDetail.vue')
    },
    {
      //交割合约
      path:'/deliveryContract',
      name:'deliveryContract',
      component: () => import(/* webpackChunkName: "deliveryContract" */ /* webpackPrefetch: true */'@/page/deliveryContract/index.vue')
    },
    {
      //交割合约历史
      path:'/deliveryContractHistory',
      name:'DeliveryContractHistory',
      component: () => import(/* webpackChunkName: "DeliveryContractHistory" */ /* webpackPrefetch: true */'@/page/DeliveryContractHistory/index.vue')
    },
    {
      //详情走势图
      path:'/trendDetails/:symbol',
      name:'trendDetails',
      meta: { keepAlive: true },
      component: () => import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */'@/page/TtrendDetails/index.vue')
    },
    { //客服
      path:'/customerService',
      name:'customerService',
      component: () => import(/* webpackChunkName: "customerService" */ /* webpackPrefetch: true */'@/page/customerService/index.vue')
    },
    { //登录
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "login" */ /* webpackPrefetch: true */ '@/page/login/index.vue'),
      meta: { keepAlive: true}
    },
    { //注册
      path: '/register',
      name: 'register',
      component: () => import(/* webpackChunkName: "register" */ /* webpackPrefetch: true */'@/page/register/index.vue')
    },
    { //验证码
      path: '/verify',
      name: 'verify',
      component: () => import(/* webpackChunkName: "verify" */ /* webpackPrefetch: true */'@/page/register/verify.vue')
    },
    { //设置资金密码
      path: '/setFond',
      name: 'setFond',
      component: () => import(/* webpackChunkName: "setFond" */ /* webpackPrefetch: true */'@/page/register/setFond.vue')
    },
    { //注册身份认证
      path: '/identity',
      name: 'identity',
      component: () => import(/* webpackChunkName: "identity" */ /* webpackPrefetch: true */'@/page/register/identity.vue')
    },
    { //谷歌验证
      path: '/gooleVerify',
      name: 'gooleVerify',
      component: () => import(/* webpackChunkName: "gooleVerify" */ /* webpackPrefetch: true */'@/page/register/gooleVerify.vue')
    },
    { //注册完成
      path: '/finish',
      name: 'finish',
      component: () => import(/* webpackChunkName: "finish" */ /* webpackPrefetch: true */'@/page/register/finish.vue')
    },
    {
      path: '/trade/:symbol',
      name: 'Trade',
      meta: { footer: true, keepAlive: true },
      component: () => import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */ '@/page/trade/index.vue')
    },
    {//币币详情
      path: '/tradeDetail',
      name: 'tradeDetail',
      component: () => import(/* webpackChunkName: "tradeDetail" */ /* webpackPrefetch: true */'@/page/tradeDetail/index.vue')
    },
    {//币币记录
      path: '/tradeRecord/:symbol',
      name: 'tradeRecord',
      component: () => import(/* webpackChunkName: "tradeRecord" */ /* webpackPrefetch: true */'@/page/tradeRecord/index.vue')
    },
    {//忘记密码
      path: '/forget',
      name: 'forget',
      component: () => import(/* webpackChunkName: "forget" */ /* webpackPrefetch: true */'@/page/forget/index.vue')
    },
    {//重置登录密码
      path: '/resetPassword',
      name: 'resetPassword',
      component: () => import(/* webpackChunkName: "resetPassword" */ /* webpackPrefetch: true */'@/page/forget/resetPassword.vue')
    },
    {//忘记密码修改成功
      path: '/passSuccess',
      name: 'passSuccess',
      component: () => import(/* webpackChunkName: "passSuccess" */ /* webpackPrefetch: true */'@/page/forget/passSuccess.vue')
    },
    {//安全验证
      path: '/safeVerify',
      name: 'safeVerify',
      component: () => import(/* webpackChunkName: "safeVerify" */ /* webpackPrefetch: true */'@/page/forget/safeVerify.vue')
    },
    {//个人中心
      path: '/userCenter',
      name: 'userCenter',
      component: () => import(/* webpackChunkName: "userCenter" */ /* webpackPrefetch: true */'@/page/userCenter/index.vue')
    },
    {//安全中心
      path: '/safety',
      name: 'safety',
      component: () => import(/* webpackChunkName: "safety" */ /* webpackPrefetch: true */'@/page/safety/index.vue')
    },
    {//更换绑定
      path: '/changeVerify',
      name: 'changeVerify',
      component: () => import(/* webpackChunkName: "changeVerify" */ /* webpackPrefetch: true */'@/page/safety/changeVerify.vue')
    },
    {//修改登录密码
      path: '/changePassword',
      name: 'changePassword',
      component: () => import(/* webpackChunkName: "changePassword" */ /* webpackPrefetch: true */'@/page/changePassword/index.vue')
    },
    {//修改登录密码
      path: '/changeFundsPassword',
      name: 'changeFundsPassword',
      component: () => import(/* webpackChunkName: "changeFundsPassword" */ /* webpackPrefetch: true */'@/page/changeFundsPassword/index.vue')
    },
    {//绑定验证
      path: '/bindVerify',
      name: 'bindVerify',
      component: () => import(/* webpackChunkName: "bindVerify" */ /* webpackPrefetch: true */'@/page/bindVerify/index.vue')
    },
    {//重置绑定
      path: '/resetVerify',
      name: 'resetVerify',
      component: () => import(/* webpackChunkName: "resetVerify" */ /* webpackPrefetch: true */'@/page/resetVerify/index.vue')
    },
    {//
      path: '/resetSuccess',
      name: 'resetSuccess',
      component: () => import(/* webpackChunkName: "resetSuccess" */ /* webpackPrefetch: true */'@/page/resetVerify/resetSuccess.vue')
    },
    {
      path: "/fm-home",
      name: "financialManagement",
      meta: { keepAlive: true},
      component: () =>
        import(/* webpackChunkName: "financialManagement" */ /* webpackPrefetch: true */"@/page/financialManagement/index"),
    },
    {
      path: "/pool-lock",
      name: "PooLock",
      component: () =>
        import(/* webpackChunkName: "PooLock" */ /* webpackPrefetch: true */"@/page/financialManagement/poolLock"),
    },
    {
      path: "/machine",
      name: "Machine",
      meta: {keepAlive: true },
      component: () =>
        import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */"@/page/financialManagement/miningMachineHome"),
    },
    {
      path: "/fund",
      name: "Fund",
      meta: {keepAlive: true},
      component: () =>
        import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */"@/page/financialManagement/fundHome"),
    },
    {
      path: "/machine-rule",
      name: "Machinerule",
      meta: { keepAlive: true},
      component: () =>
        import(/* webpackChunkName: "Machinerule" */ /* webpackPrefetch: true */"@/page/financialManagement/machineRule"),
    },
    {
      path: "/fund-rule",
      name: "Fundrule",
      meta: { keepAlive: true },
      component: () =>
        import(/* webpackChunkName: "Fundrule" */ /* webpackPrefetch: true */"@/page/financialManagement/fundRule"),
    },
    {
      path: "/machine-buy",
      name: "MachineBuy",
      component: () =>
        import(/* webpackChunkName: "MachineBuy" */ /* webpackPrefetch: true */"@/page/financialManagement/machineBuy"),
    },
    {
      path: "/fund-buy",
      name: "FundBuy",
      component: () =>
        import(/* webpackChunkName: "FundBuy" */ /* webpackPrefetch: true */"@/page/financialManagement/fundBuy"),
    },
    {//
      path: '/order-success',
      name: 'orderSuccess',
      component: () => 
        import(/* webpackChunkName: "orderSuccess" */ /* webpackPrefetch: true */'@/page/financialManagement/orderSuccess.vue')
    },
    {//公告中心
      path: '/announce',
      name: 'Announce',
      component: () => 
        import(/* webpackChunkName: "Announce" */ /* webpackPrefetch: true */'@/page/announce/index.vue')
    },
    {//公告详情
      path: '/announceDetail',
      name: 'AnnounceDetail',
      component: () => import(/* webpackChunkName: "AnnounceDetail" */ /* webpackPrefetch: true */'@/page/announce/announceDetail.vue')
    },
    {//质押借币
      path: '/pledgeLoan',
      name: 'PledgeLoan',
      component: () => import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */'@/page/pledgeLoan/index.vue')
    }, 
    {//质押订单
      path: '/pledgeLoanOrder',
      name: 'pledgeLoanOrder',
      component: () => import(/* webpackChunkName: "pledgeLoanOrder" */ /* webpackPrefetch: true */'@/page/pledgeLoan/pledgeLoanOrder.vue')
    }, 
    {//质押订单详情
      path: '/pledgeLoanOrderDetail',
      name: 'PledgeLoanOrderDetail',
      component: () => import(/* webpackChunkName: "PledgeLoanOrderDetail" */ /* webpackPrefetch: true */'@/page/pledgeLoan/pledgeLoanOrderDetail.vue')
    }, 
    {//新增质押
      path: '/addPledge',
      name: 'AddPledge', 
      component: () => import(/* webpackChunkName: "AddPledge" */ /* webpackPrefetch: true */'@/page/pledgeLoan/addPledge.vue')
    },
    {//续借
      path: '/pledgeLoanRenew',
      name: 'PledgeLoanRenew',
      component: () => import(/* webpackChunkName: "PledgeLoanRenew" */ /* webpackPrefetch: true */'@/page/pledgeLoan/pledgeLoanRenew.vue')
    },
    {//质押记录
      path: '/pledgeRecord',
      name: 'PledgeRecord',
      component: () => import(/* webpackChunkName: "PledgeRecord" */ /* webpackPrefetch: true */'@/page/pledgeLoan/pledgeRecord.vue')
    },
    {//还款
      path: '/repayment',
      name: 'Repayment',
      component: () => import(/* webpackChunkName: "Repayment" */ /* webpackPrefetch: true */'@/page/pledgeLoan/repayment.vue')
    },
    {//认证中心
      path: '/certificationCenter',
      name: 'CertificationCenter',
      component: () => import(/* webpackChunkName: "CertificationCenter" */ /* webpackPrefetch: true */'@/page/certificationCenter/index.vue')
    },
    {//高级认证
      path: '/advancedCtf',
      name: 'AdvancedCtf',
      component: () =>import(/* webpackChunkName: "AdvancedCtf" */ /* webpackPrefetch: true */'@/page/certificationCenter/advancedCtf.vue')
    },
    {//联系客服选择
      path: '/customerSelect',
      name: 'customerSelect',
      component: () => import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */'@/page/customerService/customerSelect.vue')
    }, 
    {
      //c2c自选区我要买
      path: '/wantBuy',
      name: 'WantBuy',
      meta: {
        keepAlive: false,
      },
      component: () => import(/* webpackChunkName: "Home" */ /* webpackPrefetch: true */'@/page/placeAnOrder/page/wantBuy/index'),
    },
    {
      //广告筛选
      path: '/wantBuy/adScreening',
      name: 'adScreening',
      component: () => import(/* webpackChunkName: "adScreening" */ /* webpackPrefetch: true */'@/page/placeAnOrder/page/adScreening'),
    },
    {
      //c2c购买
      path: '/wantBuy/c2cBuy',
      name: 'c2cBuy',
      component: () => import(/* webpackChunkName: "c2cBuy" */ /* webpackPrefetch: true */'@/page/c2c-trade/page/c2cBuy'),
    },
    {
      //c2c交易相关回答
      path: '/c2cTransactionAnswer',
      name: 'C2cTransactionAnswer',
      component: () => import(/* webpackChunkName: "C2cTransactionAnswer" */ /* webpackPrefetch: true */'@/page/c2cAnswer/index'),
      props(route) {
        return {
          ...route.query
        }
      }
    },
    {//广告详情
      path: '/adDetails',
      name: 'AdDetails',
      component: () => import(/* webpackChunkName: "AdDetails" */ /* webpackPrefetch: true */'@/page/myAd/adDetails')
    },
    {//历史广告
      path: '/AdHistory',
      name: 'AdHistory',
      component: () => import(/* webpackChunkName: "AdHistory" */ /* webpackPrefetch: true */'@/page/myAd/AdHistory')
    },
    {//编辑广告/发布广告
      path: '/editAd',
      name: 'EditAd',
      component: () => import(/* webpackChunkName: "EditAd" */ /* webpackPrefetch: true */'@/page/myAd/editAd')
    },
    {//保存广告
      path: '/saveAd',
      name: 'SaveAd',
      component: () => import(/* webpackChunkName: "SaveAd" */ /* webpackPrefetch: true */'@/page/myAd/saveAd')
    },
    {// 收款方式
      path: "/paymentMethod",
      name: 'paymentMethod',
      component: () => import(/* webpackChunkName: "paymentMethod" */ /* webpackPrefetch: true */"@/page/placeAnOrder/page/payment-method/PaymentMethod")
    },
    {
      // 银行卡详情
      path: '/wantBuy/bankCar',
      name: 'bankCarDetail',
      component: () =>
        import(/* webpackChunkName: "bankCarDetail" */ /* webpackPrefetch: true */'@/page/placeAnOrder/components/bankCardDetail/index'),
      props(route) {
        return {
          ...route.query
        }
      }
    },
    {
      // 添加收款方式
      path: '/wantBuy/addPaymentMethod',
      name: 'addPaymentMethod',
      component: () =>
        import(/* webpackChunkName: "addPaymentMethod" */ /* webpackPrefetch: true */'@/page/placeAnOrder/page/addPaymentMethod/AddPaymentMethod'),
    },
    {
      // c2c买卖交易
      path: '/c2cTrade',
      name: 'c2cTrade',
      meta: {
        keepAlive: false,
      },
      props(route) {
        return {
          ...route.query,
        }
      },
      component: () => import(/* webpackChunkName: "c2cTrade" */ /* webpackPrefetch: true */'@/page/c2c-trade'),
    },
    {
      // c2c用户中心更多数据
      path: '/c2cUser/c2cUserMore',
      name: 'c2cUserMore',
      component: () => import(/* webpackChunkName: "c2cUserMore" */ /* webpackPrefetch: true */'@/page/c2cUser/page/c2cUserMore'),
    },
    {
      //c2c帮助中心
      path: '/c2cHelpCenter',
      name: 'HelpCenter',
      component: () => import(/* webpackChunkName: "c2cHelpCenter" */ /* webpackPrefetch: true */'@/page/c2cHelpCenter/index'),
    },
    {
      // c2c通知中心
      path: '/c2cNoticeSettings',
      name: 'c2cNoticeSettings',
      component: () => import(/* webpackChunkName: "c2cNoticeSettings" */ /* webpackPrefetch: true */'@/page/c2cUser/page/c2cNoticeSettings'),
    },
    {
      // 生成订单详情页
      path: '/orderGeneration',
      name: 'orderGeneration',
      component: () => import(/* webpackChunkName: "orderGeneration" */ /* webpackPrefetch: true */'@/page/c2cOrder/order-generation'),
      props(route) {
        return {
          ...route.query,
        }
      },
    },
    {
      // 取消订单
      path: '/cancelOrder',
      name: 'cancelOrder',
      component: () => import(/* webpackChunkName: "cancelOrder" */ /* webpackPrefetch: true */'@/page/c2cOrder/cancel-order/cancelOrder'),
    },
    {
      // 申诉
      path: '/appeal',
      name: 'appeal',
      component: () => import(/* webpackChunkName: "appeal" */ /* webpackPrefetch: true */'@/page/c2cOrder/appeal'),
    },
    {
      // 申诉成功
      path: '/appeal/page',
      name: 'appealSuccess',
      component: () => import(/* webpackChunkName: "appealSuccess" */ /* webpackPrefetch: true */'@/page/c2cOrder/appeal/Appeal'),
    },
    {// 付款
      path: '/paymentBuy',
      name: 'paymentBuy',
      component: () => import(/* webpackChunkName: "paymentBuy" */ /* webpackPrefetch: true */"@/page/c2cOrder/payment/PaymentBuy"),
    },
    {
      // 付款
      path: '/payment',
      name: 'payment',
      component: () => import(/* webpackChunkName: "payment" */ /* webpackPrefetch: true */'@/page/c2cOrder/payment'),
      props(route) {
        return {
          ...route.query,
        }
      },
    },
    {
      // 付款详情
      path: '/paymentDetail',
      name: 'paymentDetail',
      component: () => import(/* webpackChunkName: "paymentDetail" */ /* webpackPrefetch: true */'@/page/c2cOrder/payment/PaymentDetail'),
    },
    {
      // 广告商个人信息详情
      path: '/advertisers-info',
      component: () => import(/* webpackChunkName: "advertisers-info" */ /* webpackPrefetch: true */'@/page/advertisers/info'),
      props(route) {
        return {
          ...route.query,
        }
      },
    },
    {
      // c2c收款方式
      path: '/c2cCollection',
      component: () => import(/* webpackChunkName: "c2cCollection" */ /* webpackPrefetch: true */'@/page/c2c-trade/page/c2cCollection'),
      props(route) {
        return {
          ...route.query,
        }
      },
    },
    {
      // 广告商个人信息详情
      path: '/advertiserDetail',
      component: () => import(/* webpackChunkName: "advertiserDetail" */ /* webpackPrefetch: true */'@/page/advertiserDetail/index'),
      props(route) {
        return {
          ...route.query
        }
      }
    },
    {
      // 广告商个人信息详情
      path: '/advertiserDetail/detail',
      component: () => import(/* webpackChunkName: "advertiserDetail" */ /* webpackPrefetch: true */'@/page/advertiserDetail/detail'),
    },
    {
      // 广告历史记录
      path: '/advertiserHistory',
      component: () => import(/* webpackChunkName: "advertiserHistory" */ /* webpackPrefetch: true */'@/page/advertiserHistory/index'),
    },
    {
      // 广告历史记录详情
      path: '/advertiserHistory/detail',
      component: () => import(/* webpackChunkName: "advertiserHistory" */ /* webpackPrefetch: true */'@/page/advertiserHistory/detail'),
    },
    {
      // 成为认证广告商
      path: '/CertifiedAdvertiser',
      component: () => import(/* webpackChunkName: "CertifiedAdvertiser" */ /* webpackPrefetch: true */'@/page/myAd/CertifiedAdvertiser'),
    },
    {
      // 选择法币
      path: '/selectLegalCurrency',
      component: () => import(/* webpackChunkName: "selectLegalCurrency" */ /* webpackPrefetch: true */'@/page/selectLegalCurrency/index'),
    },
    {// c2c出售订单生成
      path: '/sellGenerate',
      component: () => import(/* webpackChunkName: "sellGenerate" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/SellGenerate"),
      props(route) {
        return {
          ...route.query
        }
      }
    },
    {// 确认收款
      path: '/confirmedPaid',
      meta: {  keepAlive: true },
      component: () => import(/* webpackChunkName: "confirmedPaid" */ /* webpackPrefetch: true */"@/page/c2cOrder/payment/ConfirmedPaid")
    },
    {// 验证码验证
      path: '/verification',
      component: () => import(/* webpackChunkName: "verification" */ /* webpackPrefetch: true */"@/page/verification-code/VerificationCode")
    },
    {// 买家交易成功
      path: '/tradeSuccessBuyer',
      component: () => import(/* webpackChunkName: "tradeSuccessBuyer" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/TradeSuccessBuyer")
    },
    {// 卖家交易
      path: '/tradeSuccessSell',
      component: () => import(/* webpackChunkName: "tradeSuccessSell" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/TradeSuccessSell")
    },
    {// 买家交易成功详情
      path: '/tradeSuccessDetailBuyer',
      component: () => import(/* webpackChunkName: "tradeSuccessDetailBuyer" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/TradeSuccessDetailBuyer")
    },
    {// 卖家交易成功详情
      path: '/tradeSuccessDetailSell',
      component: () => import(/* webpackChunkName: "tradeSuccessDetailSell" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/TradeSuccessDetailSell")
    },
    {// 联系买家/卖家
      path: '/chat',
      component: () => import(/* webpackChunkName: "chat" */ /* webpackPrefetch: true */"@/page/chat"),
      props(route) {
        return {
          ...route
        }
      }
    },
    {
      path: '/c2c_normal_user',
      meta: { requireAuth: true },
      component: () => import(/* webpackChunkName: "c2c_normal_user" */ /* webpackPrefetch: true */"@/page/c2cUser/normalUserCenter")
    },
    {// c2c页面
      path: '/c2c',
      component: () => import(/* webpackChunkName: "c2c" */ /* webpackPrefetch: true */"@/page/c2c"),
      children: [
        {
          path: 'c2cUser',
          meta: { requireAuth: true, isMerchant: true },
          component: () => import("@/page/c2cUser")
        },

        {
          // 订单列表
          path: 'orderList',
          meta: { requireAuth: true, isMerchant: true },
          component: () => import('@/page/orderList/index'),
        },
        {
          //接单模式广告
          path: 'advertise',
          name: 'Advertise',
          meta: { requireAuth: true, isMerchant: true },
          component: () => import('@/page/myAd/index'),
        },
        {
          // 接单模式
          path: 'receivingBuy',
          meta: { requireAuth: true, isMerchant: true },
          component: () => import('@/page/receivingBuy/index'),
        },
      ]
    },
    {// c2c帮助
      path: '/c2cHelp',
      name: 'C2cHelp',
      meta: { requireAuth: true },
      component: () => import(/* webpackChunkName: "c2cHelp" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/c2cHelp")
    },
    // {//质押借币
    //   path: '/pledgeLoan',
    //   name: 'PledgeLoan',
    //   component: () => import('@/page/pledgeLoan/index.vue')
    // },
    // {//质押订单
    //   path: '/pledgeLoanOrder',
    //   name: 'pledgeLoanOrder',
    //   component: () => import('@/page/pledgeLoan/pledgeLoanOrder.vue')
    // },
    // {//质押订单详情
    //   path: '/pledgeLoanOrderDetail',
    //   name: 'PledgeLoanOrderDetail',
    //   component: () => import('@/page/pledgeLoan/pledgeLoanOrderDetail.vue')
    // },
    // {//新增质押
    //   path: '/addPledge',
    //   name: 'AddPledge',
    //   component: () => import('@/page/pledgeLoan/addPledge.vue')
    // },
    // {//续借
    //   path: '/pledgeLoanRenew',
    //   name: 'PledgeLoanRenew',
    //   component: () => import('@/page/pledgeLoan/pledgeLoanRenew.vue')
    // },
    // {//质押记录
    //   path: '/pledgeRecord',
    //   name: 'PledgeRecord',
    //   component: () => import('@/page/pledgeLoan/pledgeRecord.vue')
    // },
    // {//还款
    //   path: '/repayment',
    //   name: 'Repayment',
    //   component: () => import('@/page/pledgeLoan/repayment.vue')
    // },
    // {//认证中心
    //   path: '/certificationCenter',
    //   name: 'CertificationCenter',
    //   component: () => import('@/page/certificationCenter/index.vue')
    // },
    // {//高级认证
    //   path: '/advancedCtf',
    //   name: 'AdvancedCtf',
    //   component: () => import('@/page/certificationCenter/advancedCtf.vue')
    // },
    { // c2c订单列表
      path: '/wantBuy/c2cOrderList',
      component: () => import(/* webpackChunkName: "c2cOrderList" */ /* webpackPrefetch: true */"@/page/c2c-order-list"),
      props(route) {
        return {
          ...route.query
        }
      }
    },
    { // c2c订单详情
      path: '/tradeOrderDetail',
      component: () => import(/* webpackChunkName: "tradeOrderDetail" */ /* webpackPrefetch: true */"@/page/c2c-trade/page/tradeOrderDetail"),
    },
    {// 快捷区
      path: '/wantBuy/quick',
      component: () => import(/* webpackChunkName: "quick" */ /* webpackPrefetch: true */"@/page/quick")
    },
    //Trend details
    { path: '*', redirect: '/home' },
  ],
})
router.beforeEach((to, from, next) => {
  if (to.meta.requireAuth) {
    // 判断该路由是否需要登录权限
    if (store.state.user.userInfo.token) {
      // 通过vuex state获取当前的token是否存在
      if (to.meta.isMerchant) {
        if (store.state.user.userInfo.c2c_user_type !== 0) {
          next()
        } else {
          Toast(this.$t('您不是承兑商'))
          next('/')
        }
      } else {
        next()
      }
      next()
    } else {
      next({
        path: '/login',
        query: { redirect: to.fullPath }, // 将跳转的路由path作为参数，登录成功后跳转到该路由
      })
    }
  } else {
    next()
  }
  //next() //这个是全局的路由守卫 你复习一下   这里做了路由鉴权 不登陆不给访问页面 我现在注释掉了 直接可以通过
})
export default router
